// 用户相关的接口
import request from "@/uilts/request";
import type { geomResponseData, reportResponseData } from "./type";
// 统一管理接口
enum API {
  REPORT_QUERY_GEOM = "/gis/report/queryGeom",
  REPORT_QUERY_REPORT = "/gis/report/queryReport",
  REPORT_QUERY_RIGHT_REPORT = "/gis/report/queryRightReport",
  REPORT_LIST_TREE = "/gis/report/listTree",
  REPORT_COUNT_GROUP_BY = "/gis/report/countGroupBy",
  REPORT_FINDTABLE_LIST = "/gis/report/findTableList",
  REPORT_PAGE_CUSTOM = "/gis/report/pageCustom",
  REPORT_EXPORT = "/gis/report/export",
  REPORT_TRANSFORMER_GET = "/gis/report/transformer/getDeviceById",
  REPORT_LAMPPOST_GET = "/gis/report/lampPost/getDeviceListById",
  REPORT_LOOP_GET = "/gis/report/loop/getDeviceById",
  REPORT_COUNT_CUSTOM = "/gis/report/countCustom",
}
//  查询区域地图点位
export const queryGeomGet = (data: string) =>
  request.get<any, geomResponseData>(`${API.REPORT_QUERY_GEOM}/${data}`, {});
//  查询左侧统计数据
export const queryReportGet = (data: string) =>
  request.get<any, reportResponseData>(
    `${API.REPORT_QUERY_REPORT}/${data}`,
    {}
  );
//  查询右侧统计数据
export const queryRightReportPost = (data: any) =>
  request.post<any, reportResponseData>(API.REPORT_QUERY_RIGHT_REPORT, data);
//  获取表字段树
export const listTreePost = () =>
  request.get<any, reportResponseData>(API.REPORT_LIST_TREE, {});
//  框选查询设备数量,可选择查询设备类型
export const countGroupByPost = (data: any) =>
  request.post<any, reportResponseData>(API.REPORT_COUNT_GROUP_BY, data);
//  分页查询
export const pageListPost = (data: any, url: string) =>
  request.post<any, reportResponseData>(url, data);
//  根据表编码查询字段 -过滤未启动的字段 1 过滤 0 否
export const findTableListGet = (code: string, isEnable: number) =>
  request.get<any, geomResponseData>(
    `${API.REPORT_FINDTABLE_LIST}/${code}/${isEnable}`,
    {}
  );
//  自定义分页查询
export const pageCustomPost = (data: any) =>
  request.post<any, reportResponseData>(API.REPORT_PAGE_CUSTOM, data);
//  列表详情查询
export const listInforGet = (type: string, id: string) =>
  request.get<any, geomResponseData>(`/gis/report/${type}/get/${id}`, {});
//  导出
export const exportPost = (data: any) =>
  request.post<any, reportResponseData>(
    `${API.REPORT_EXPORT}/资产报表导出数据`,
    data
  );
//  变压器关联设备查询
export const transformerGetDeviceByIdGet = (id: string) =>
  request.get<any, geomResponseData>(`${API.REPORT_TRANSFORMER_GET}/${id}`, {});
//  灯杆挂载设备查询
export const lampPostGetDeviceByIdGet = (id: string) =>
  request.get<any, geomResponseData>(`${API.REPORT_LAMPPOST_GET}/${id}`, {});
//  回路关联设备查询
export const loopGetDeviceByIdGet = (id: string) =>
  request.get<any, geomResponseData>(`${API.REPORT_LOOP_GET}/${id}`, {});
//  自定义数量统计查询
export const countCustomPost = (data: any) =>
  request.post<any, reportResponseData>(`${API.REPORT_COUNT_CUSTOM}`, data);
